﻿using System.Diagnostics;

namespace UmSoft.SharePoint.Integration.Bdc.Core
{
    class Logger
    {

        // \HKLM\SYSTEM\CurrentControlSet\services\eventlog\Investa\Connector1c
        private static readonly string EventSourceName = "Connector1c";
        private static readonly string EventLogName = "Investa";
        EventLog eventLog;
        public Logger()
        {
            // if (!EventLog.SourceExists(EventSourceName))
            //    EventLog.CreateEventSource(EventSourceName, EventLogName);
            eventLog = new EventLog(EventLogName);
            eventLog.Source = EventSourceName;


        }
        public void write(string message, EventLogEntryType type)
        {
            eventLog.WriteEntry(message, type);
        }
        public void write(string message, EventLogEntryType type, int eventId)
        {
            // EventLogPermission elp = new EventLogPermission(EventLogPermissionAccess.Administer, ".");
            // elp.PermitOnly();
            eventLog.WriteEntry(message, type, eventId);
        }



    }
}
